package com.socket.batch.deal;

import com.socket.batch.collector.MessageCollector;
import com.socket.batch.transmit.BatchTransmitter;
import com.socket.batch.transmit.ITransmitter;

/**
 * Created by kaddddd on 2017/7/10 0010.
 */
public class DealFactory {

    private static IDeal iDeal = null;

    public static IDeal getDeal(){
        if(iDeal!=null){
            return iDeal;
        }

        synchronized (DealFactory.class){
            if(iDeal==null){
                String handlerClass = BatchDeal.class.getName();
                Class<?> clazz = null;
                try{
                    clazz = Thread.currentThread().getContextClassLoader().loadClass(handlerClass);
                    iDeal = (IDeal) clazz.newInstance();
                }catch (Throwable cfe){

                }
            }
        }
        return iDeal;
    }
}
